package com.suxiaoxiao.springbootlearn;

import com.suxiaoxiao.springbootlearn.spring.framework.applicationcontext.initializer.ApplicationContextInitializerDemo;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.stream.Stream;

/**
 * @SpringBootApplication = @Configuration + @EnableAutoConfiguration + @ComponentScan
 *
 * 1. @ComponentScan
 *      1.1 TypeExcludeFilter 扩展的组件过滤
 *      1.2 AutoConfigurationExcludeFilter
 * 2. @SpringBootConfiguration
 *      2.1 @Configuration
 *          一个被 @Configuration 标注的类，相当于 applicationContext.xml 配置文件
 * 3. @EnableAutoConfiguration
 *      3.1 @AutoConfigurationPackage
 */
@SpringBootApplication
public class SpringbootlearnApplication {

    public static void main(String[] args) {
//        SpringApplication.run(SpringbootlearnApplication.class, args);
        /**
         * 自定义 SpringApplication
         */
        SpringApplication springApplication = new SpringApplication(SpringbootlearnApplication.class);
        // 强制使用 WebMvc 环境
//        springApplication.setWebApplicationType(WebApplicationType.SERVLET);
        // 不打印Banner
//        springApplication.setBannerMode(Banner.Mode.OFF);
        // 添加 初始化器
        springApplication.addInitializers(new ApplicationContextInitializerDemo());
        springApplication.run(args);
    }

}
